home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Applications / P4⁄Mac 2.0d4 / Test programs / interactive.p < prev    next >
Encoding:
Text File  |  1996-09-28  |  492 b   |  38 lines  |  [TEXT/p4?M]

  1. program Interactive;
  2.  
  3. var
  4.   i:integer;
  5.   s:packed array[1..16] of char;
  6.  
  7. procedure readstring;
  8. begin
  9. i:=1;
  10.  repeat
  11.      read(input,s[i]);
  12.    i:=i+1;
  13.  until (ord(s[i-1]) = 13) or (i >= 16);
  14. end;
  15.  
  16. begin
  17.  writeln('Welcome!');
  18.  writeln('1: Hej');
  19.  writeln('2: Hopp');
  20.  writeln('0: Quit');
  21.  repeat
  22.   read(i);
  23.   case i of
  24.   1:
  25.     writeln('Hej');
  26.   2:
  27.     writeln('Hopp');
  28.   0:
  29.     writeln('Quitting');
  30.   end; (*case*)
  31.  until i = 0;
  32.  
  33.  writeln('Bye-bye!');
  34.  
  35.  readstring;
  36.  writeln('You wrote', s);
  37. end.
  38.